<template>
  <el-input-number
    v-model="bindValue"
    :type="props.getType"
    :style="{
      width: defaultConfig.maxWidth + '%',
      minWidth: defaultConfig.minWidth + 'px',
    }"
    :disabled="props.disabled"
    :placeholder="defaultConfig.placeholder"
    :min="defaultConfig.limit.min"
    :max="defaultConfig.limit.max"
    :precision="defaultConfig.precision"
  />
</template>

<script lang="ts" setup>
import { ref, inject, watch } from 'vue';
import { anyObj } from '@/utils/indexType';
import { connectObj } from '@/utils/index';
const props = defineProps({
  getKey: {
    type: String,
    default: () => {
      return '';
    },
  },
  getValue: {
    type: String,
    default: () => {
      return '';
    },
  },
  getType: {
    type: String,
    default: () => {
      return '';
    },
  },
  disabled: {
    type: Boolean,
    default: () => {
      return false;
    },
  },
});

const defaultConfig = ref<any>({
  placeholder: '',
  maxWidth: '460',
  minWidth: '300',
  autosize: { minRows: 2, maxRows: 2 },
});

// @ts-ignore
const getSecond = inject<anyObj>('testConfig')[props.getKey].elIntConfig;

connectObj(defaultConfig.value, getSecond);

const bindValue = getSecond[props.getValue];
</script>
